package com.jh.netty.mqtt;


import org.eclipse.paho.client.mqttv3.*;

import java.util.UUID;

public class MqttV3 {

    public static void main(String[] args) throws MqttException {
        MqttClient client = new MqttClient(
                "tcp://mqtt.cn-zly.com:9999",
                UUID.randomUUID().toString());

        MqttConnectOptions options = new MqttConnectOptions();
        options.setUserName("ef1ac9cd117d437cb53a285ce6fbe22a");
        options.setPassword("bd3ecf6c64f5435b92f83553f9dee17c".toCharArray());

        client.setCallback(new MqttCallback() {
            @Override
            public void connectionLost(Throwable cause) {

            }

            @Override
            public void messageArrived(String topic, MqttMessage message) throws Exception {

            }

            @Override
            public void deliveryComplete(IMqttDeliveryToken token) {

            }
        });
        client.connect(options);
    }
}
